#include <bits/stdc++.h>

using namespace std;
const int N = 100010;
int a[N], tr[N];
int n, m;

int lowBit(int x)
{
    return (x & -x);
}

void add(int x, int v)
{
    for (int i = x; i <= n; i += lowBit(i))
    {
        tr[i] += v;
    }
}

int query(int x)
{
    int res = 0;
    for (int i = x; i; i -= lowBit(i))
    {
        res += tr[i];
    }
    return res;
}

int main()
{
    scanf("%d %d", &n, &m);
    for (int i = 1; i <= n; ++i)
    {
        scanf("%d", &a[i]);
    }
    for (int i = 1; i <= n; ++i)
    {
        add(i, a[i]);
    }
    while (m--)
    {
        int k, x, y;
        scanf("%d%d%d", &k, &x, &y);
        if (k == 0)
        {
            printf("%d\n", query(y) - query(x - 1));
        }
        else 
        {
            add(x, y);
        }
    }
    return 0;
}